/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.confiteriofuentes.modelo;

import com.confiteriafuentes.modelo.solicitud.DetalleCamion;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Man
 */
public class DetalleCamionDAO implements IDAO<DetalleCamion> {

    private Model model;
    private PreparedStatement psInsert;

    public DetalleCamionDAO() throws SQLException {
        model = Model.getInstance();
    }

    public void insert(DetalleCamion t) throws SQLException {
        if (psInsert == null) {
            String sqlInsert = "INSERT INTO detalle_camion (cod_cond,cod_cam, fecha_asignacion) VALUES (?,?,?)";
            psInsert = (PreparedStatement) model.getCon().prepareStatement(sqlInsert);

       psInsert.setInt(1,t.getConductor().getCodigo());
       psInsert.setString(2, t.getCamion().getPlaca());

       java.sql.Date fecha = new java.sql.Date(t.getFehca().getTime());

       psInsert.setDate(3, fecha);

       psInsert.executeUpdate();
        }

     




    }

    public void delete(DetalleCamion t) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public List<DetalleCamion> getAll() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public DetalleCamion find(Integer id) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void update(DetalleCamion t) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }






}
